{% extends "base.html" %}
{% block jquery%}<script type="text/javascript" src="/site_media/js/jquery.js"></script>
<script type="text/javascript">
    function savedraft()
{
    newdata = "mail_id="+escape($("#mail_id").val())+"&name="+escape($("#name").val())+"&touser="+escape($("#touser").val())+"&content="+escape($("#cont").val());
    $.ajax({
url:"{{HOST}}/mailsbox/savedraft/",
type:"POST",
data:"mail_id="+$("#mail_id").val()+"&name="+$("#name").val()+"&touser="+$("#touser").val()+"&content="+$("#cont").val(),
//data: newdata,
})
var cur_time = new Date();
$("#tip").val("已经在 " + cur_time.toLocaleString() +" 保存了! 每1分钟自动保存一次,你也可以点击存草稿立即保存.");
}
var myInterval = setInterval("savedraft()", 10000);
</script>
{% endblock %}
{% block current_title %}发件箱{% endblock %}
<p>
{% block welcome %}写信给你的好友。{% endblock %}</p>

{% block body %}
<form action="{{HOST}}/mailsbox/sendmail/" method="POST" >
        <ul><li><input type="hidden" name="mail_id" value="{{ mail.id }}" id="mail_id" ></li>
        <ul><li>标题：<input type="text" name="name" value="{{ mail.subject }}" id="name" ></li>
        <ul><li>收件人：<input type="text" name="touser" value="{{ mail.touser}}" id="touser" ></li>
            <li>内容:<textarea name="content" id="cont">{{ mail.content }}</textarea></li>
    <li><input type="submit" value="提交"> <li>
    <li><input type="button" value="存草稿" onclick="savedraft()"> <li>
    </ul>
    </form>
    <input type="text" id="tip" value="还没有保存! 每1分钟自动保存一次,你也可以点击存草稿立即保存." size=100 readonly>
    {% endblock %}
